<div class="divmain">
<table width="100%" id="fmfrmmonitoring_tblinfo" class="tblInfo">
<tr>
    <td valign="top" class="width20"  >
<div >
<table class="info" id="fmfrmmonitoring_info">
<tr>
<td>
<div id="fmfrmmonitoring_divleft" class="divleft">
<table class="width100 tbltranparents">
<tr>
 <td align="right"  class="width70">Thời gian load dữ liệu:</td>
 <td id="fmfrmmonitoring_timeReload"></td>
</tr>
<tr>
 <td align="right" >Thời gian còn lại:</td>
 <td id="fmfrmmonitoring_timeRemain"></td>
</tr>
<tr><td colspan="2"><div style="width:100%;background-color:transparent;" id="fmfrmmonitoring_divNow"></div></td></tr>
</table>
</div>
</td>
</tr>
       
</table>
<div class="divDialog" id="fmfrmmonitoring_divProduct">
    </div>
</div>
</td>            
<td height="400" valign="top" class="tbltranparents">
<div class="divGrid tbltranparents" id="fmfrmmonitoring_divGrid" align="center" style="overflow:auto">
</div></td>
<td class="clsend"></td>
</tr>
</table>
</div>
<script language="javascript">
var fmfrmmonitoring_timeRemain = TIMEREMAIN_MONITORING;
$(document).ready(function () {
    initForm('fmfrmmonitoring_tblinfo');
    initDivleft();
    $('#fmfrmmonitoring_divGrid').height($(window).height()-82);
    $( window ).resize(function() {
        $('#fmfrmmonitoring_divGrid').height($(window).height()-82);
    }); 
    $('.clsDivOn .clsMonitoringNam').live('click',function(){
        
        xajax_fmfrmmonitoring_LoadProduct($(this).attr('id'));
     
    });  
    
        $('#fmfrmmonitoring_divProduct').dialog({
        autoOpen:false,
        titel: 'Danh sách sản phẩm',
        modal:true,
        width :500,
        resizable:true,
        overflow: 'auto'
    });
    
});

setTimeout('LoadMonitoring()',TIMEREMAIN_MONITORING*60*1000);
function LoadMonitoring(){
    setTimeout('LoadMonitoring()',TIMEREMAIN_MONITORING*60*1000);
    var menuId =  $('#tabs1 > div.ui-tabs-panel:not(.ui-tabs-hide) >div>ul>li.ui-state-active:first').attr('id');
    fmfrmmonitoring_timeRemain = TIMEREMAIN_MONITORING*60; 
    if(menuId==MENUID_MONITORING){               
        changeWaiting(0);
     //$('.trProductMonitoring').remove();
     xajax_fmfrmmonitoring_loadRoom(); 
    }
}



function fmfrmmonitoring_loadProduct(Room_id,product_id,product_name,num,priceP,type_Pro){
   btnid = product_id;
   price = '';
   price = priceP;
   price = formatMoney(price);
      $( '<tr class="trProductMonitoring" ><td width="70%" align="left" >'+product_name+'</td><td  width="20%">'+price+'</td> <td width="10%"  align="center" >'+num+'</td></tr>' ).appendTo( $('#fmfrmmonitoring_div_'+Room_id).find('table:first')); 
     
}

function fmfrmmonitoring_hideRoom(id,obj){
    if($(obj).hasClass('expand')){
        $(obj).removeClass().addClass('collapse');
        $('#fmfrmmonitoring_tableType_'+id).hide();
        $(obj).attr('src','adagps.com/images/icons/cong.png');
    }else{
        $(obj).removeClass().addClass('expand');
        $('#fmfrmmonitoring_tableType_'+id).show();
        $(obj).attr('src','adagps.com/images/icons/tru.png');
    }
}

function fmfrmmonitoring_firstload(){
    visitMonitoring = true;
    var timereload = TIMEREMAIN_MONITORING+' PHÚT/LẦN'; 
    $('#fmfrmmonitoring_timeReload').html(timereload);
    fm_addJsContext();
    changeWaiting(0);
    xajax_fmfrmmonitoring_loadRoom();  
   //xajax_fmfrmmonitoring_loadProduct();
}

function fmfrmmonitoring_AssignRoom(id,current_id,timerent){
    $('#fmfrmonitoring_divView_'+id).removeClass('clsDivOff').addClass('clsDivOn');
    $('#fmfrmonitoring_tdtimeIn_'+id).html(timerent);
/*    $('#fmfrmonitoring_tdNumPerson_'+id).html(numperson);
    $('#fmfrmonitoring_tdNumGlass_'+id).html(numglass);*/
    $('#fmfrmonitoring_spClock_'+id).show();

    $('.clsDivOn').attr('title','Bấm vào xem sản phẩm trong phòng');
    $('.clsDivOff').attr('title','Phòng đang trống');
   // alert(timestamp);
   // alert(timerent);
}
function fmfrmmonitoring_resetView(){
   $('.clsDivOn').removeClass('clsDivOn').addClass('clsDivOff'); 
   $('.clsMonitoringClock').hide(); 
}
     

changeWaiting(0);
//fmAssignTime();
xajax_fmfrmmonitoring_init();
//xajax_fmfrmmonitoring_fillMenuParent();
//xajax_fmfrmmonitoring_init();
</script>
